﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>个人资料</title>
    <link rel="shortcut icon" href="favicon.ico">
	<link href="css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/plugins/checkboxes/checkboxes.min.css" rel="stylesheet">
    <link href="css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="css/style.min.css?v=4.0.0" rel="stylesheet">
	<style>
		.dl-horizontal dt{width:70px;padding-bottom:10px;line-height:30px;}
		.dl-horizontal dd{margin-left:85px;}
	</style>
</head>

<body>
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox-content">

				<form id="argForm" class="form-horizontal m-t">
				<div class="col-sm-6">
					<dl class="dl-horizontal">
						<dt>账号：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="username" type="hidden" class="form-control" >
								<input disabled id="username" type="text" class="form-control" >
							</div>
						</dd>
						<dt>昵称：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="nickName" type="text" class="form-control" >
							</div>
						</dd>

						<dt>状态：</dt>
						<dd id="status" style="padding: 5px 0 0 0;">
						</dd>

						<dt>邮箱：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="mail" type="text" class="form-control">
							</div>
						</dd>

						<dt>签名：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="signature" type="text" class="form-control">
							</div>
						</dd>

						<dt>生日：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="birthday" type="text" class="form-control">
							</div>
						</dd>

						<dt>职位：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input name="position" type="text" class="form-control">
							</div>
						</dd>

					</dl>
				</div>
				<div class="col-sm-6">
					<dl class="dl-horizontal">
						<dt>创建时间：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input disabled name="createTime" type="text" class="form-control">
							</div>
						</dd>

						<dt>创建人：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input disabled name="createBy" type="text" class="form-control">
							</div>
						</dd>

						<dt>更新时间：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input disabled name="updateTime" type="text" class="form-control">
							</div>
						</dd>

						<dt>更新人：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input disabled name="updateBy" type="text" class="form-control">
							</div>
						</dd>

						<dt>来源：</dt>
						<dd>
							<div class="input-group input-group-sm ">
								<input disabled name="source" type="text" class="form-control">
							</div>
						</dd>

						<dt>备注：</dt>
						<dd>
							<textarea name="note" class="form-control"></textarea>
						</dd>
					</dl>
				</div>
				</form>
			</div>
		</div>
	</div>
	<div class="col-sm-2 col-sm-offset-5">
		<button onclick="updateMyInfo()" class="btn btn-w-m btn-success">更新</button>
	</div>
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.5"></script>
    <script src="js/content.min.js?v=1.0.0"></script>
	<script src="js/plugins/toastr/toastr.min.js"></script>
    <script type="text/javascript" src="js/custom/app.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/custom/tools.js" charset="UTF-8"></script>
	<script>
	function searchMyInfo(){
		var url = 'sysUser/getMyUserInfo';
		jQuery.ajax({
			url:domain + url,
			type:"get",
			data:{},
			crossDomain:true,
			xhrFields:{
				withCredentials:true
			},
			success:function (data) {
				if(data.status == 200){
					combHTML(data.data);
				}else{
					top.toastr.warning(data.msg);
				}
			},
			error:function(data) {
				top.toastr.error("查询列表失败，请检查网络");
			}
		})

	}

	function combHTML(data){
		$("#username").val(data.username);
		$("input[name=username]").val(data.username);
		$("input[name=nickName]").val(data.nickName);
		$("#status").html(getCheckboxes(data.status));
		$("input[name=mail]").val(data.mail);
		$("input[name=signature]").val(data.signature);
		$("input[name=birthday]").val(data.birthday);
		$("input[name=position]").val(data.position);
		$("input[name=createTime]").val(data.createTime);
		$("input[name=createBy]").val(data.createBy);
		$("input[name=updateTime]").val(data.updateTime);
		$("input[name=updateBy]").val(data.updateBy);
		$("input[name=source]").val(data.source);
		$("textarea[name=note]").val(data.note);

	}

	function updateMyInfo(){
		var formData = new FormData($("form#argForm")[0]);
		var url = 'sysUser/updateMyUserInfo';
		jQuery.ajax({
			url:domain + url,
			type:"post",
			data:JSON.stringify(formData2JsonStr(formData)),
			contentType:"application/json;charset=utf-8",
			crossDomain:true,
			xhrFields:{
				withCredentials:true
			},
			success:function (data) {
				if(data.status == 200){
					searchMyInfo();
					top.toastr.success("更新成功");
				}else{
					top.toastr.warning(data.msg);
				}
			},
			error:function(data) {
				top.toastr.error("操作失败，请检查网络");
			}
		})
	}

	$(function(){
		searchMyInfo();
	})
	</script>
</body>

</html>
